package com.ruoyi.backend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.backend.mapper.AnnounceMapper;
import com.ruoyi.backend.domain.Announce;
import com.ruoyi.backend.service.IAnnounceService;

/**
 * 系统轮播通告Service业务层处理
 * 
 * @author wjr
 * @date 2025-09-25
 */
@Service
public class AnnounceServiceImpl implements IAnnounceService 
{
    @Autowired
    private AnnounceMapper announceMapper;

    /**
     * 查询系统轮播通告
     * 
     * @param id 系统轮播通告主键
     * @return 系统轮播通告
     */
    @Override
    public Announce selectAnnounceById(Integer id)
    {
        return announceMapper.selectAnnounceById(id);
    }

    /**
     * 查询系统轮播通告列表
     * 
     * @param announce 系统轮播通告
     * @return 系统轮播通告
     */
    @Override
    public List<Announce> selectAnnounceList(Announce announce)
    {
        return announceMapper.selectAnnounceList(announce);
    }

    /**
     * 新增系统轮播通告
     * 
     * @param announce 系统轮播通告
     * @return 结果
     */
    @Override
    public int insertAnnounce(Announce announce)
    {
        announce.setCreateTime(DateUtils.getNowDate());
        return announceMapper.insertAnnounce(announce);
    }

    /**
     * 修改系统轮播通告
     * 
     * @param announce 系统轮播通告
     * @return 结果
     */
    @Override
    public int updateAnnounce(Announce announce)
    {
        announce.setUpdateTime(DateUtils.getNowDate());
        return announceMapper.updateAnnounce(announce);
    }

    /**
     * 批量删除系统轮播通告
     * 
     * @param ids 需要删除的系统轮播通告主键
     * @return 结果
     */
    @Override
    public int deleteAnnounceByIds(Integer[] ids)
    {
        return announceMapper.deleteAnnounceByIds(ids);
    }

    /**
     * 删除系统轮播通告信息
     * 
     * @param id 系统轮播通告主键
     * @return 结果
     */
    @Override
    public int deleteAnnounceById(Integer id)
    {
        return announceMapper.deleteAnnounceById(id);
    }
}
